//**************************************************************** 
//* Copyright (c) 2008 Ford Motor Company. All Rights Reserved. 
//* 
//* $$Workfile:   EconomicIndexDefFacade.java  $$ 
//* $$Revision:   1.2  $$ 
//* $$Author:   TMALDON4  $$ 
//* $$Date:   Feb 06 2009 05:31:52  $$ 
//* 
//***************************************************************** 
package ar.com.ford.it.fullEconomics.facade;

import java.util.Collection;
import ar.com.ford.it.fullEconomics.exception.FullEconomicsException;
import ar.com.ford.it.fullEconomics.logic.EconomicIndexDefLogic;
import ar.com.ford.it.fullEconomics.persistence.dto.Teese01Economic;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesg01Plant;
import ar.com.ford.it.fullEconomics.wslx.FullEconomicsWslxUser;

/**
 * Operaciones Asociadas a Economic index definition
 * 
 * @author vcanal
 * 
 */
public class EconomicIndexDefFacade {
    /**
     * Search economic Index
     * 
     * @param code
     * @param name
     * @param plant
     * @return
     * @throws FullEconomicsException
     */

    public Collection findEconomicIndexDef(String code, String name, String sour, Teesg01Plant plant) throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        Collection ret = logic.findEconomicIndexDef(code, name, sour, plant);

        return ret;
    }

    /**
     * Create Economic Index en TEESE02 y relaciones en las tablas 
     * @param economicIndexDef
     * @param user
     * @param codeCurren 
     * @param codeSour 
     * @throws FullEconomicsException 
     */
    public void createEconomicIndexDef(Teese01Economic economicIndex,
                                     FullEconomicsWslxUser user, String codeSour, String codeCurren) throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        logic.createEconomicIndexDef(economicIndex, user, codeSour , codeCurren);
    }
    /**
     * Consulta si la descripcion que se desea ingresar es unica para 
     * @param plant
     * @param desc
     * @return
     * @throws FullEconomicsException 
     */
    public boolean findUnicDescription (Teesg01Plant plant, String desc ) throws FullEconomicsException{
       EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
       boolean result = logic.findUnicDescription(plant,desc);
       return result;
    }
    /**
     * Actualizacion de Indice Economico
     * @param economicIndexDef
     * @param user
     * @param codeCurren 
     * @param codeSour 
     * @throws FullEconomicsException 
     */
    public void updateEconomicIndexDef(Teese01Economic economicIndexDef,
                                     FullEconomicsWslxUser user, String codeSour, String codeCurren) throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        logic.updateEconomicIndexDef(economicIndexDef, user, codeSour, codeCurren);
    }
    
    /**
     * Delete de Indice Economic
     * @param economicIndexDef
     * @throws FullEconomicsException 
     */
    public boolean deleteEconomicIndexDef(Teese01Economic economicIndexDef) throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        return logic.deleteEconomicIndexDef(economicIndexDef);
    }
    /**
     * Busca indice economico segun codigo
     * @param plant
     * @param codeEco
     * @return
     * @throws FullEconomicsException 
     */
    public Teese01Economic findEconomicIndexByCode (Teesg01Plant plant , String codeEco) throws FullEconomicsException{
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        Teese01Economic result = logic.findEconomicIndexByCode(plant, codeEco);
        return result;
    }
    /**
     * Find All de indices Economicos
     * @param plant
     * @return
     * @throws FullEconomicsException
     */
    public Collection findAllEconomicIndex(Teesg01Plant plant) throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        Collection result = logic.findAllEconomicIndex(plant);
        return result;
    }
    
    public boolean economicIndexCanBeProposed(Teese01Economic item) {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        boolean ret = false;

        ret = logic.economicIndexCanBeProposed(item);
        return ret;
    }

    /**
     * Determina si el Indice Economico pasado por parametro puede ser aprobado
     * 
     * @param economicIndex
     * Indice Economico a determinar si puede ser aprobado
     * @return
     */
    public boolean economicIndexCanBeApproved(Teese01Economic economicIndex) {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        boolean ret = false;

        ret = logic.economicIndexCanBeApproved(economicIndex);
        return ret;
    }

    /**
     * Propone el Indice Economico pasado por parametro
     * 
     * @param economicIndex
     * Indice Economico a proponer
     * @throws FullEconomicsException
     */
    public void proposeEconomicIndex(Teese01Economic economicIndex, FullEconomicsWslxUser user)
            throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();

        logic.proposeEconomicIndex(economicIndex, user);
    }

    /**
     * Aprueba el Indice Economico pasado por parametro
     * 
     * @param economicIndex
     * Indice Economico a aprobar
     * @throws FullEconomicsException
     */
    public void approveEconomicIndex(Teese01Economic economicIndex, FullEconomicsWslxUser user)
            throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();

        logic.approveEconomicIndex(economicIndex, user);
    }

    // ================= FAVIO =========================

    /**
     * 
     * @param plant
     * @param year
     * @param econSourceNumber
     * @return
     * @throws FullEconomicsException
     */
    public Collection getEconomicSourceStatus(Teesg01Plant plant, String year,
                                              String econSourceNumber, String valueType)
            throws FullEconomicsException {
        EconomicIndexDefLogic logic = new EconomicIndexDefLogic();
        Collection res = null;

        res = logic.getEconomicSourceStatus(plant, year, econSourceNumber, valueType);
        return res;
    }

    // ================= FAVIO =========================

}
